package com.ruili.framework.utils.ip;

import com.ruili.framework.config.RuiliConfig;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class IPServiceFactory {

    @Autowired
    private PconlineIpServiceImpl pconlineIpServiceImpl;

    @Autowired
    private RuiliConfig ruiliConfig;

    public static final String IP_SERVICE_PCONLINE = "PCONLINE";

    public IpService getInstance(){
        String servicer = ruiliConfig.getIpService().getService();
        if (StringUtils.isEmpty(servicer)){
            return null;
        }
        switch (servicer){
            case IP_SERVICE_PCONLINE:
                return pconlineIpServiceImpl;
            default:
                return pconlineIpServiceImpl;
        }
    }
}
